{% extends 'layout.html' %}
{% block title %}
home
{% endblock %}
{%block body%}
<script type=text/javascript>
	$(function(){
		
		$( "#activity-types" ).buttonset();
		$('#search').click(function(){
			key = $('#search-text').attr('value');
			$('#act-list').load('/activity/list?key=' + key);
		});
		$('.type-btn').click(function(){
			type = $(this).attr('id').substr(5);
			$('#act-list').load('/activity/list?type=' + type);
		});
	})
</script>
	<ul class='btn-bar'>
		<li><a href='/activity/create' class='button'>创建活动</a></li>
		<li><a class='button'>最新</a></li>
		<div id='activity-types'>
			<li><input type='radio' id='type_all' name='radio' checked='checked'/><label for="type_all" class='type-btn' id='type_all'>所有</label></li>
			{%for type in types%}
				<li><input type='radio' id='type_{{type.id}}' name='radio'/><label for="type_{{type.id}}" class='type-btn' id='type_{{type.id}}'>{{type.name}}</label></li>
			{%endfor%}
		</div>
		<div class='float-right'>
			<form>
				<input type='text' id='search-text'/>	
				<a class='button' id='search'><img src='{{url_for("static", filename="image/search.png")}}'></a>
			</form>
		</div>
	</ul>
	<div class='clear'></div>
	<div id='act-list'>
		{%include 'activity/list.html'%}
	</div>

{% endblock %}
